package com.dce.dev.api.controller.delivery;

import java.util.List;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.dce.dev.api.common.tools.JsonFileTool;
import com.dce.dev.api.common.tools.json.JsonUtils;
import com.dce.dev.api.dto.base.ResultDTO;
import com.dce.dev.api.dto.delivery.AbnormalRecordDTO;
import com.dce.dev.api.dto.delivery.AbnormalRecordDetailDTO;
import com.dce.dev.api.dto.delivery.AbnormalRecordDetailReqDTO;
import com.dce.dev.api.dto.delivery.AttendanceConfirmationDTO;
import com.dce.dev.api.dto.delivery.DeliveryCollectDTO;
import com.dce.dev.api.dto.delivery.DeliveryContactInfoReqDTO;
import com.dce.dev.api.dto.delivery.DeliveryDTO;
import com.dce.dev.api.dto.delivery.DeliveryDetailDTO;
import com.dce.dev.api.dto.delivery.DeliveryDetailListDTO;
import com.dce.dev.api.dto.delivery.DeliveryDisputDetailDTO;
import com.dce.dev.api.dto.delivery.DeliveryDisputDetailReqDTO;
import com.dce.dev.api.dto.delivery.DeliveryDisputRecordDTO;
import com.dce.dev.api.dto.delivery.DeliveryDisputRecordReqDTO;
import com.dce.dev.api.dto.delivery.DeliveryDriverInfoReqDTO;
import com.dce.dev.api.dto.delivery.DeliveryFunctionDTO;
import com.dce.dev.api.dto.delivery.DeliveryInspectInfoDTO;
import com.dce.dev.api.dto.delivery.DeliveryInvoiceDetailDTO;
import com.dce.dev.api.dto.delivery.DeliveryNoReqDTO;
import com.dce.dev.api.dto.delivery.DeliveryProgressDTO;
import com.dce.dev.api.dto.delivery.DeliverySpareTimeDTO;
import com.dce.dev.api.dto.delivery.DeliveryTimeDTO;
import com.dce.dev.api.dto.delivery.DeliveryTimeSaveReqDTO;
import com.dce.dev.api.dto.delivery.DeliveryVehicleInfoReqDTO;
import com.dce.dev.api.dto.delivery.EvaluateRecordDTO;
import com.dce.dev.api.dto.delivery.EvaluateTemplateDTO;
import com.dce.dev.api.dto.delivery.EvaluateTemplateReqDTO;
import com.dce.dev.api.dto.delivery.InspectInfoDTO;
import com.dce.dev.api.dto.delivery.InspectorDTO;
import com.dce.dev.api.dto.delivery.NeedInspectReqDTO;
import com.dce.dev.api.dto.delivery.SaveAbnormalRecordReqDTO;
import com.dce.dev.api.dto.delivery.SaveDeliveryDisputRecordReqDTO;
import com.dce.dev.api.dto.delivery.SaveDeliveryInvoiceInfoReqDTO;
import com.dce.dev.api.dto.delivery.SaveDetailDetailReqDTO;
import com.dce.dev.api.dto.delivery.SaveEvaluateRecordReqDTO;
import com.dce.dev.api.dto.delivery.SetInspectorsReqDTO;
import com.dce.dev.api.dto.delivery.VarietyDTO;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 交割信息接口
 */
@RestController
@RequestMapping("/delivery/info/")
@Api(value = "后台服务--交割基础功能", description = "后台服务--交割基础功能")
public class DeliveryInfoController {

	@RequestMapping(value = "/getVarietyList", method = RequestMethod.POST)
	@ApiOperation(value = "获取品种列表")
	public ResultDTO<List<VarietyDTO>> getVarietyList() {
		String strJson = JsonFileTool.readJSON("delivery/variety.json");
		final List<VarietyDTO> dtoRtn = JsonUtils.jsonToPojo(strJson, List.class);
		return ResultDTO.success(dtoRtn, "列表获取成功");
	}

	@RequestMapping(value = "/getDeliveryList", method = RequestMethod.POST)
	@ApiOperation(value = "获取交割列表")
	public ResultDTO<List<DeliveryDTO>> getDeliveryList() {
		String strJson = JsonFileTool.readJSON("delivery/delivery.json");
		final List<DeliveryDTO> dtoRtn = JsonUtils.jsonToPojo(strJson, List.class);
		return ResultDTO.success(dtoRtn, "列表获取成功");
	}

	@RequestMapping(value = "/getDeliveryDetail", method = RequestMethod.POST)
	@ApiOperation(value = "获取交割详情")
	public ResultDTO<DeliveryDetailDTO> getDeliveryDetail() {
		String strJson = JsonFileTool.readJSON("delivery/deliverydetail.json");
		final DeliveryDetailDTO dtoRtn = JsonUtils.jsonToPojo(strJson, DeliveryDetailDTO.class);
		return ResultDTO.success(dtoRtn, "交割获取获取成功");
	}

	@RequestMapping(value = "/getDeliveryProgressList", method = RequestMethod.POST)
	@ApiOperation(value = "获取进度详情")
	public ResultDTO<List<DeliveryProgressDTO>> getDeliveryProgressList(@RequestBody DeliveryNoReqDTO dtoReq) {
		String strJson = JsonFileTool.readJSON("delivery/deliveryprogress.json");
		final List<DeliveryProgressDTO> dtoRtn = JsonUtils.jsonToPojo(strJson, List.class);
		return ResultDTO.success(dtoRtn, "列表获取成功");
	}

	@RequestMapping(value = "/saveNeedInspect", method = RequestMethod.POST)
	@ApiOperation(value = "保存是否需要质检")
	public ResultDTO<Void> saveNeedInspect(@RequestBody NeedInspectReqDTO dtoReq) {
		// String strJson =
		// JsonFileTool.readJSON("basebusiness/delivery/deliveryprogress.json");
		// final List<DeliveryProgressDTO> dtoRtn =
		// JsonUtils.jsonToPojo(strJson, List.class);
		return ResultDTO.success("保存成功");
	}

	@RequestMapping(value = "/getInspectInfo", method = RequestMethod.POST)
	@ApiOperation(value = "显示质检信息接口")
	public ResultDTO<InspectInfoDTO> getInspectInfo(@RequestBody DeliveryNoReqDTO dtoReq) {
		String strJson = JsonFileTool.readJSON("delivery/inspectinfo.json");
		final InspectInfoDTO dtoRtn = JsonUtils.jsonToPojo(strJson, InspectInfoDTO.class);
		return ResultDTO.success(dtoRtn, "质检信息获取成功");
	}

	@RequestMapping(value = "/addDeliveryContactInfo", method = RequestMethod.POST)
	@ApiOperation(value = "新增交割联系人信息")
	public ResultDTO<Void> addDeliveryContactInfo(@RequestBody DeliveryContactInfoReqDTO dtoReq) {
		// String strJson =
		// JsonFileTool.readJSON("basebusiness/delivery/deliveryprogress.json");
		// final List<DeliveryProgressDTO> dtoRtn =
		// JsonUtils.jsonToPojo(strJson, List.class);
		return ResultDTO.success("保存成功");
	}

	@RequestMapping(value = "/addDeliveryVehicleInfo", method = RequestMethod.POST)
	@ApiOperation(value = "新增车辆信息")
	public ResultDTO<Void> addDeliveryVehicleInfo(@RequestBody DeliveryVehicleInfoReqDTO dtoReq) {
		// String strJson =
		// JsonFileTool.readJSON("basebusiness/delivery/deliveryprogress.json");
		// final List<DeliveryProgressDTO> dtoRtn =
		// JsonUtils.jsonToPojo(strJson, List.class);
		return ResultDTO.success("保存成功");
	}

	@RequestMapping(value = "/addDeliveryDriverInfo", method = RequestMethod.POST)
	@ApiOperation(value = "新增驾驶员信息")
	public ResultDTO<Void> addDeliveryDriverInfo(@RequestBody DeliveryDriverInfoReqDTO dtoReq) {
		// String strJson =
		// JsonFileTool.readJSON("basebusiness/delivery/deliveryprogress.json");
		// final List<DeliveryProgressDTO> dtoRtn =
		// JsonUtils.jsonToPojo(strJson, List.class);
		return ResultDTO.success("保存成功");
	}

	@RequestMapping(value = "/addDeliverySpareTime", method = RequestMethod.POST)
	@ApiOperation(value = "新增备选交收时间")
	public ResultDTO<Void> addDeliverySpareTime(@RequestBody DeliverySpareTimeDTO dtoReq) {
		// String strJson =
		// JsonFileTool.readJSON("basebusiness/delivery/deliveryprogress.json");
		// final List<DeliveryProgressDTO> dtoRtn =
		// JsonUtils.jsonToPojo(strJson, List.class);
		return ResultDTO.success("保存成功");
	}

	@RequestMapping(value = "/getDeliveryTime", method = RequestMethod.POST)
	@ApiOperation(value = "查看交收时间列表")
	public ResultDTO<List<DeliveryTimeDTO>> getDeliveryTime(@RequestBody DeliveryNoReqDTO dtoReq) {
		String strJson = JsonFileTool.readJSON("delivery/deliverytime.json");
		final List<DeliveryTimeDTO> dtoRtn = JsonUtils.jsonToPojo(strJson, List.class);
		return ResultDTO.success(dtoRtn, "列表获取成功");
	}

	@RequestMapping(value = "/setDeliveryTime", method = RequestMethod.POST)
	@ApiOperation(value = "选择交收时间")
	public ResultDTO<Void> setDeliveryTime(@RequestBody DeliveryTimeSaveReqDTO dtoReq) {
		// String strJson =
		// JsonFileTool.readJSON("basebusiness/delivery/deliveryprogress.json");
		// final List<DeliveryProgressDTO> dtoRtn =
		// JsonUtils.jsonToPojo(strJson, List.class);
		return ResultDTO.success("保存成功");
	}

	@RequestMapping(value = "/getInspectorList", method = RequestMethod.POST)
	@ApiOperation(value = "查询质检员列表")
	public ResultDTO<List<InspectorDTO>> getInspectorList() {
		String strJson = JsonFileTool.readJSON("delivery/inspector.json");
		final List<InspectorDTO> dtoRtn = JsonUtils.jsonToPojo(strJson, List.class);
		return ResultDTO.success(dtoRtn, "列表获取成功");
	}

	@RequestMapping(value = "/setInspectors", method = RequestMethod.POST)
	@ApiOperation(value = "设置质检员")
	public ResultDTO<Void> setInspectors(SetInspectorsReqDTO dto) {
		// String strJson =
		// JsonFileTool.readJSON("basebusiness/delivery/deliveryprogress.json");
		// final List<DeliveryProgressDTO> dtoRtn =
		// JsonUtils.jsonToPojo(strJson, List.class);
		return ResultDTO.success("保存成功");
	}

	@RequestMapping(value = "/getAttendanceConfirmationList", method = RequestMethod.POST)
	@ApiOperation(value = "查询到场确认列表")
	public ResultDTO<List<AttendanceConfirmationDTO>> getAttendanceConfirmationList(@RequestBody DeliveryNoReqDTO dtoReq) {
		String strJson = JsonFileTool.readJSON("delivery/attendanceconfirmationlist.json");
		final List<AttendanceConfirmationDTO> dtoRtn = JsonUtils.jsonToPojo(strJson, List.class);
		return ResultDTO.success(dtoRtn, "列表获取成功");
	}
	
	@RequestMapping(value = "/getDeliveryCollect", method = RequestMethod.POST)
	@ApiOperation(value = "交收汇总信息查询")
	public ResultDTO<DeliveryCollectDTO> getDeliveryCollectList(@RequestBody DeliveryNoReqDTO dtoReq) {
		String strJson = JsonFileTool.readJSON("delivery/deliverycollect.json");
		final DeliveryCollectDTO dtoRtn = JsonUtils.jsonToPojo(strJson, DeliveryCollectDTO.class);
		return ResultDTO.success(dtoRtn, "交收信息查询成功");
	}
	
	@RequestMapping(value = "/getDeliveryDetailList", method = RequestMethod.POST)
	@ApiOperation(value = "交收信息列表查询")
	public ResultDTO<List<DeliveryDetailListDTO>> getDeliveryDetailList(@RequestBody DeliveryNoReqDTO dtoReq) {
		String strJson = JsonFileTool.readJSON("delivery/deliverydetaillist.json");
		final List<DeliveryDetailListDTO> dtoRtn = JsonUtils.jsonToPojo(strJson, List.class);
		return ResultDTO.success(dtoRtn, "列表获取成功");
	}
	
	
	
	@RequestMapping(value = "/saveDeliveryDetail", method = RequestMethod.POST)
	@ApiOperation(value = "新增交收信息")
	public ResultDTO<Void> saveDeliveryDetail(SaveDetailDetailReqDTO dto) {
		// String strJson =
		// JsonFileTool.readJSON("basebusiness/delivery/deliveryprogress.json");
		// final List<DeliveryProgressDTO> dtoRtn =
		// JsonUtils.jsonToPojo(strJson, List.class);
		return ResultDTO.success("保存成功");
	}
	
	
	@RequestMapping(value = "/getDeliveryDisputRecord", method = RequestMethod.POST)
	@ApiOperation(value = "获取争议列表信息")
	public ResultDTO<List<DeliveryDisputRecordDTO>> getDeliveryDisputRecord(@RequestBody DeliveryDisputRecordReqDTO dtoReq) {
		String strJson = JsonFileTool.readJSON("delivery/deliverydisputrecord.json");
		final List<DeliveryDisputRecordDTO> dtoRtn = JsonUtils.jsonToPojo(strJson, List.class);
		return ResultDTO.success(dtoRtn, "列表获取成功");
	}
	
	@RequestMapping(value = "/getDeliveryDisputRecordDetail", method = RequestMethod.POST)
	@ApiOperation(value = "获取争议详情")
	public ResultDTO<DeliveryDisputDetailDTO> getDeliveryDisputRecordDetail(@RequestBody DeliveryDisputDetailReqDTO dtoReq) {
		String strJson = JsonFileTool.readJSON("delivery/deliverydisputDetail.json");
		final DeliveryDisputDetailDTO dtoRtn = JsonUtils.jsonToPojo(strJson, DeliveryDisputDetailDTO.class);
		return ResultDTO.success(dtoRtn, "争议详情获取成功");
	}
	
	@RequestMapping(value = "/getDeliveryFunctionList", method = RequestMethod.POST)
	@ApiOperation(value = "获取交割控制台列表")
	public ResultDTO<List<DeliveryFunctionDTO>> getDeliveryFunctionList(@RequestBody DeliveryNoReqDTO dtoReq) {
		String strJson = JsonFileTool.readJSON("delivery/deliveryfunctionlist.json");
		final List<DeliveryFunctionDTO> dtoRtn = JsonUtils.jsonToPojo(strJson, List.class);
		return ResultDTO.success(dtoRtn, "列表获取成功");
	}
	
	@RequestMapping(value = "/saveDeliveryDisputRecord", method = RequestMethod.POST)
	@ApiOperation(value = "新增争议")
	public ResultDTO<Void> saveDeliveryDisputRecord(SaveDeliveryDisputRecordReqDTO dto) {
		// String strJson =
		// JsonFileTool.readJSON("basebusiness/delivery/deliveryprogress.json");
		// final List<DeliveryProgressDTO> dtoRtn =
		// JsonUtils.jsonToPojo(strJson, List.class);
		return ResultDTO.success("保存成功");
	}
	
	@RequestMapping(value = "/getAbnormalRecord", method = RequestMethod.POST)
	@ApiOperation(value = "获取异常信息列表")
	public ResultDTO<List<AbnormalRecordDTO>> getAbnormalRecord(@RequestBody DeliveryNoReqDTO dtoReq) {
		String strJson = JsonFileTool.readJSON("delivery/abnormalrecordlist.json");
		final List<AbnormalRecordDTO> dtoRtn = JsonUtils.jsonToPojo(strJson, List.class);
		return ResultDTO.success(dtoRtn, "列表获取成功");
	}
	
	@RequestMapping(value = "/getAbnormalRecordDetail", method = RequestMethod.POST)
	@ApiOperation(value = "获取异常信息详情")
	public ResultDTO<AbnormalRecordDetailDTO> getAbnormalRecordDetail(@RequestBody AbnormalRecordDetailReqDTO dtoReq) {
		String strJson = JsonFileTool.readJSON("delivery/abnormalrecorddetail.json");
		final AbnormalRecordDetailDTO dtoRtn = JsonUtils.jsonToPojo(strJson, AbnormalRecordDetailDTO.class);
		return ResultDTO.success(dtoRtn, "争议详情获取成功");
	}
	
	@RequestMapping(value = "/saveAbnormalRecord", method = RequestMethod.POST)
	@ApiOperation(value = "新增异常信息")
	public ResultDTO<Void> saveAbnormalRecord(SaveAbnormalRecordReqDTO dto) {
		// String strJson =
		// JsonFileTool.readJSON("basebusiness/delivery/deliveryprogress.json");
		// final List<DeliveryProgressDTO> dtoRtn =
		// JsonUtils.jsonToPojo(strJson, List.class);
		return ResultDTO.success("保存成功");
	}
	
	
	
	@RequestMapping(value = "/getCompleteConfirmationList", method = RequestMethod.POST)
	@ApiOperation(value = "交割完成列表查询")
	public ResultDTO<List<AttendanceConfirmationDTO>> getCompleteConfirmationList(@RequestBody DeliveryNoReqDTO dtoReq) {
		String strJson = JsonFileTool.readJSON("delivery/completeconfirmationlist.json");
		final List<AttendanceConfirmationDTO> dtoRtn = JsonUtils.jsonToPojo(strJson, List.class);
		return ResultDTO.success(dtoRtn, "列表获取成功");
	}
	
	@RequestMapping(value = "/getEvaluateTemplateList", method = RequestMethod.POST)
	@ApiOperation(value = "获取评价模板")
	public ResultDTO<List<EvaluateTemplateDTO>> getEvaluateTemplateList(@RequestBody EvaluateTemplateReqDTO dtoReq) {
		String strJson = JsonFileTool.readJSON("delivery/evaluatetemplatelist.json");
		final List<EvaluateTemplateDTO> dtoRtn = JsonUtils.jsonToPojo(strJson, List.class);
		return ResultDTO.success(dtoRtn, "列表获取成功");
	}
	
	@RequestMapping(value = "/saveEvaluateRecord", method = RequestMethod.POST)
	@ApiOperation(value = "新增评价信息")
	public ResultDTO<Void> saveEvaluateRecord(@RequestBody SaveEvaluateRecordReqDTO dto) {
		// String strJson =
		// JsonFileTool.readJSON("basebusiness/delivery/deliveryprogress.json");
		// final List<DeliveryProgressDTO> dtoRtn =
		// JsonUtils.jsonToPojo(strJson, List.class);
		return ResultDTO.success("保存成功");
	}
	
	
	@RequestMapping(value = "/getEvaluateRecord", method = RequestMethod.POST)
	@ApiOperation(value = "获取评价内容")
	public ResultDTO<List<EvaluateRecordDTO>> getEvaluateRecord(@RequestBody DeliveryNoReqDTO dtoReq) {
		String strJson = JsonFileTool.readJSON("delivery/evaluaterecord.json");
		final List<EvaluateRecordDTO> dtoRtn = JsonUtils.jsonToPojo(strJson, List.class);
		return ResultDTO.success(dtoRtn, "评价内容获取成功");
	}
	
	@RequestMapping(value = "/saveDeliveryInvoiceInfo", method = RequestMethod.POST)
	@ApiOperation(value = "选择交割发票")
	public ResultDTO<Void> saveDeliveryInvoiceInfo(@RequestBody SaveDeliveryInvoiceInfoReqDTO dto) {
		// String strJson =
		// JsonFileTool.readJSON("basebusiness/delivery/deliveryprogress.json");
		// final List<DeliveryProgressDTO> dtoRtn =
		// JsonUtils.jsonToPojo(strJson, List.class);
		return ResultDTO.success("保存成功");
	}
	
	
	@RequestMapping(value = "/getInvoiceDetail", method = RequestMethod.POST)
	@ApiOperation(value = "获取发票详情")
	public ResultDTO<DeliveryInvoiceDetailDTO> getInvoiceDetail(@RequestBody DeliveryNoReqDTO dtoReq) {
		String strJson = JsonFileTool.readJSON("delivery/deliveryinvoicedetail.json");
		final DeliveryInvoiceDetailDTO dtoRtn = JsonUtils.jsonToPojo(strJson, DeliveryInvoiceDetailDTO.class);
		return ResultDTO.success(dtoRtn, "发票详情获取成功");
	}
	
	@RequestMapping(value = "/getDeliveryInspectInfo", method = RequestMethod.POST)
	@ApiOperation(value = "查询交割质检员信息列表")
	public ResultDTO<DeliveryInspectInfoDTO> getDeliveryInspectInfo(@RequestBody DeliveryNoReqDTO dtoReq) {
		String strJson = JsonFileTool.readJSON("delivery/deliveryinspectinfo.json");
		final DeliveryInspectInfoDTO dtoRtn = JsonUtils.jsonToPojo(strJson, DeliveryInspectInfoDTO.class);
		return ResultDTO.success(dtoRtn, "交割质检员信息获取成功");
	}
	
	@RequestMapping(value = "/confirmBuyerCertify", method = RequestMethod.POST)
	@ApiOperation(value = "确认买方已缴费")
	public ResultDTO<Void> confirmBuyerCertify(@RequestBody SaveDeliveryInvoiceInfoReqDTO dto) {
		// String strJson =
		// JsonFileTool.readJSON("basebusiness/delivery/deliveryprogress.json");
		// final List<DeliveryProgressDTO> dtoRtn =
		// JsonUtils.jsonToPojo(strJson, List.class);
		return ResultDTO.success("保存成功");
	}
}
